﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace GameDev_Story.Cenas
{
    public class Cena_Menu
    {
        public uint local;
        Texture2D fundo;
        Texture2D seta;
        GameWindow Window;
        Vector2 posicao = new Vector2(230,0);
        SpriteFont tahoma;        

        public Cena_Menu(ContentManager Content, GameWindow Window)
        {
            this.Window = Window;
            fundo = Content.Load<Texture2D>("menu");
            seta = Content.Load<Texture2D>("seta");
            tahoma = Content.Load<SpriteFont>("tahoma");            
            local = 0;
        }

        public void Update(GameTime gameTime, KeyboardState teclado_atual, KeyboardState teclado_anterior, GamePadState joystick, GamePadState joystick_anterior)
        {
            
            if (teclado_atual.IsKeyDown(Keys.Down) && !teclado_anterior.IsKeyDown(Keys.Down) && local == 0)
            {
                local = 1;
            }
            else
            if (teclado_atual.IsKeyDown(Keys.Down) && !teclado_anterior.IsKeyDown(Keys.Down) && local == 1)
            {
                local = 2;
            }

            if (teclado_atual.IsKeyDown(Keys.Up) && !teclado_anterior.IsKeyDown(Keys.Up) && local == 1)
            {
                local = 0;
            }
            else
            if (teclado_atual.IsKeyDown(Keys.Up) && !teclado_anterior.IsKeyDown(Keys.Up) && local == 2)
            {
                local = 1;
            }
            
            if (local == 0)
            {
                posicao.Y = 400;
            }

            if (local == 1)
            {
                posicao.Y = 455;
            }

            if (local == 2)
            {
                posicao.Y = 510;
            }

            
            
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(fundo, new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height), Color.Gray);            
            spriteBatch.Draw(seta, posicao, Color.White);            
            spriteBatch.DrawString(tahoma, "INICIAR", new Vector2(280, 410), Color.Black);
            spriteBatch.DrawString(tahoma, "COMO JOGAR", new Vector2(280, 460), Color.Black);
            spriteBatch.DrawString(tahoma, "CREDITOS", new Vector2(280, 520), Color.Black);                    
        }
    }
}
